Current Location: Home> Function Categories> floor

floor

Leave the method of sorting
Name:floor
Category:math
Programming Language:php
One-line Description:Round down to the closest integer.

Definition and usage

floor() function rounds down to the closest integer.

Example

In this example, we will apply floor() function to different numbers:

 <?php
echo ( floor ( 0.60 ) ) ;
echo ( floor ( 0.40 ) ) ;
echo ( floor ( 5 ) ) ;
echo ( floor ( 5.1 ) ) ;
echo ( floor ( - 5.1 ) ) ;
echo ( floor ( - 5.9 ) )
?>

Try it yourself

grammar

 floor ( x )
parameter describe
x Required. A number.

illustrate

Returns the next integer no greater than x and rounds the decimal part of x . The type returned by floor() is still float, because the range of float values ​​is usually larger than integer.

Similar Functions
  • Get the pi value pi

    pi

    Getthepivalue
  • Round the division result intdiv

    intdiv

    Roundthedivisionresu
  • Returns exp(number) - 1, and can calculate the exact result even when the value of number is close to zero. expm1

    expm1

    Returnsexp(number)-1
  • Perform floating point division under IEEE 754 semantics fdiv

    fdiv

    Performfloatingpoint
  • Convert hexadecimal to decimal hexdec

    hexdec

    Converthexadecimalto
  • Determine whether it is a legal value is_nan

    is_nan

    Determinewhetheritis
  • Round floating point numbers round

    round

    Roundfloatingpointnu
  • Sine sin

    sin

    Sine
Popular Articles